<template name="sendcar">
	<!-- 盘点单列表 查询的BS APP是生成盘点单和录入一步完成 -->
	<view class="mypage">

		<view class="cu-bar search bg-white">
			<view class="search-form round">
				<text class="cuIcon-search"></text>
				<input type="text" placeholder="输入物资单号" v-model="keyword"></input>
			</view>
			<view class="action">
				<button class="cu-btn bg-blue shadow-blur round">搜索</button>
			</view>
		</view>
		
		<view class="card-list-wrapper">
			<view class="card-list-row radius shadow-warp bg-white margin-top" 
			v-for="(item,index) in planList" :key="index" 
			@click="openDetail(index)">
				
				<view class="flex-just-between bottom-border top-wrap">
					<text class="text-blue text-bold">盘点单号：{{ item.BILLNO }}</text>
					<view class="cu-capsule radius">
						<view class='cu-tag bg-blue sm'>
							<text class='cuIcon-medal'></text>
						</view>
						<view class="cu-tag line-brown sm">
							{{ index+1}}
						</view>
					</view>
				</view>
				
				<view class="card-list-row-1">
					<text class="cuIcon-title text-red"></text>
					<text>集团：{{ item.GROUPNAME || '' }}</text>
				</view>
				<view class="card-list-row-1">
					<text class="cuIcon-title text-red"></text>
					<text>组织：{{ item.ORGNAME || '' }}</text>
				</view>
				<!-- <view class="card-list-row-1">
					<text class="cuIcon-title text-red"></text>
					<text>盘点厂区：{{ item.ORGNAME || '' }}</text>
				</view> -->
				<view class="card-list-row-1">
					<text class="cuIcon-title text-red"></text>
					<text>仓库：{{ item.STORENAME || '' }}</text>
				</view>
				<!-- <view class="card-list-row-1">
					<text class="cuIcon-title text-red"></text>
					<text>货区：{{ item.STORENAME }}</text>
				</view> -->
		
				<!-- <view class="card-list-row-1">
					<text class="cuIcon-title text-orange"></text>
					<text>规格：{{ '52.5R '}} </text> 
					<text class="text-blue">&emsp; {{ '500吨'}}&emsp;</text> |
					<text class="text-red">&emsp;￥{{ '32.00'}}</text>
				</view> -->
		
				<!-- <view class="card-list-row-1">
					<text class="cuIcon-title text-green"></text>
					<text>收货单位： {{ '宁夏青铜峡水泥股份有限公司' }}</text>
				</view> -->
				
				<!-- <view class="flex-just-between top-border margin-top btn-wrap">
					<button class="cu-btn round lines-blue" >继续盘点</button>
					<button class="cu-btn round lines-gray" >所有盘点明细</button>
					<button class="cu-btn round lines-gray" >已盘点明细</button>
				</view> -->
				
				
			</view>
		
		</view>
		
	</view>

</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	import api from '@/common/api.js';
	import utils from '@/common/util.js';
	let query = {
			"category":"ST_INVENTORY",
			"page":1,
			"rows":"10",
			"sidx":"asc",
			"sord":"desc",
			"queryJson":"{ISFINISH:0,BILLSTATUS:0}",
			"userId":"",
			"account":"admin"
	}
	// let queryJson ;
	let _self,page=1, total=1 ;
	
	export default {
		computed: mapState(['userInfo','baseUrl']),
		data() {
			return {
				title:'列表',
				planList: [],
				keyword:''
			};
		},
		onLoad(params) {
			_self = this 
			_self.title = params.n + '列表'
			console.log(params);
			page = 1;
			total = 1 ;
			_self.getNewsList();
		},
		//下拉刷新
		onPullDownRefresh : function(){
			// 重置分页及数据
			page = 1;
			total = 1 ;
			this.planList = []
			this.getNewsList();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
			utils.tips("数据已刷新");
		},
		// 加载更多
		onReachBottom : function(){
			this.getNewsList();
		},
		methods:{
			...mapMutations(['setCheckOrder']),
			openDetail:function(e){
				// console.log(e);
				_self.setCheckOrder([_self.planList[e]]);
				uni.navigateTo({
					url:'/pages/tab01/inventory/submit-order'
				})
			},
			// apiPublic.getOrderList
			getNewsList(){
				
				if (page > total) {
				  return utils.tips("没有数据了");
				}
				query.page = page ;
				 console.log(query);
				 //  console.log(_self.baseUrl + api.apiPublic.getOrderList);
				 let URL  =  api.apiPublic.getOrderList
				 console.log(URL);
				this.axios({
						url: URL,
						data: query,
						isLoading:1
					}).then((res) => {
						let {
							IsSuccess,
							Result,
							Message
						} = res;
						if( page == 1){
							utils.setPageTitle('盘点单列表(' + res.data.Result.records + ')')
						}
						_self.planList = [..._self.planList,....res.data.Result.rows]
						total = res.data.Result.total
						page++
				})
			},
		}
	}
</script>

<style scoped>
	
	.card-list-wrapper {
		width: 710upx;
		height: 100upx;
		margin: 0 auto;
		
	}

	.card-list-row {
		padding: 20upx;
	}

	.card-list-row-1 {
		padding: 10upx 0;
	}
	.top-border{
		border-top: 1upx solid rgba(0,0,0,.1);
	}
	.top-wrap{
		padding-bottom: 20upx;
		margin-bottom: 20upx;
	}
	.bottom-border{
		border-bottom: 1upx solid rgba(0,0,0,.1);
	}
	.btn-wrap{
		padding-top: 20upx;
	}
</style>
